<?php

if(!defined('_HTML_BASE_')) {
define('_HTML_BASE_', 1);

function flep_html_print_css(&$info) {
  if(isset($info['css']) && is_array($info['css'])) {
    foreach($info['css'] as $css){
      if (file_exists(_FLEP_CSS_DIR_ . $css)) {
        echo '<link href="request.php?res='. $css .'" type="text/css" rel="stylesheet" />';
      }
    }
  }
}

function flep_html_print_js(&$info) {
  if(isset($info['js']) && is_array($info['js'])) {
    foreach($info['js'] as $js){
      if (file_exists(_FLEP_JS_DIR_ . $js)) {
        echo '<script type="text/javascript" src="request.php?res='. $js .'"></script>';
      }
    }
  }
}

function flep_html_head(&$info){
?>
<head>
  <title><?php echo flep_array_value($info, 'title')?></title>
  <meta name="viewport" content="width=device-width" />
  <?php
    flep_html_print_css($info);
    flep_html_print_js($info);
  ?>
</head>
<?php
}

function flep_html_base_header(&$page_info) {
?>
<!DOCTYPE html>
<html>
  <?php
  flep_html_head($page_info);
  ?>
  <body>
    <div id="container">
      <?php
      flep_html_header();
      ?>
      <div id="page">
<?php
}

function flep_html_base_footer() {
?>
      </div>
      <?php
      flep_html_footer();
      ?>
    </div>
  </body>
</html>
<?php
}

}
?>
